﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DataAccessLayer;
using BussinessLayer;

namespace QLBaoHanh.NghiepVu
{
    public partial class frmHoanThanhPhien : Form
    {
        private Phien _phien;
        private frmDsPhienTheoTrangThai _callerForm;
        public frmHoanThanhPhien(Phien inPhien, frmDsPhienTheoTrangThai inCallerForm)
        {
            InitializeComponent();
            _phien = inPhien;
            _callerForm = inCallerForm;
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_phien != null)
            {
                //update hoan thanh cho phien
                _phien.TrangThaiPhienId = (int)MyCommon.TrangThaiPhien.ThaoTacNgay_HoanThanh;
                _phien.ThoiDiemHoanThanh = dtpThoiDiemTra.Value;
                _phien.ChiPhi = Convert.ToInt16(txtChiPhi.Text);
                PhienBO obj = new PhienBO();
                obj.UpdatePhien(_phien);
                _callerForm.RefreshForm();
            }
            this.Close();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
